# Contributor: Mehdi Chinoune <mehdi.chinoune@hotmail.com>

_realname=mpfi
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=1.5.4
pkgrel=2
pkgdesc='C library for interval arithmetic (mingw-w64)'
arch=(any)
mingw_arch=('ucrt64' 'clang64' 'clangarm64')
url='http://perso.ens-lyon.fr/nathalie.revol/software.html'
msys2_repository_url="https://github.com/arpra-project/mpfi"
msys2_references=(
  'archlinux: mpfi'
)
license=("spdx:LGPL-2.1-or-later")
depends=("${MINGW_PACKAGE_PREFIX}-gmp"
         "${MINGW_PACKAGE_PREFIX}-mpfr")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-autotools")
source=(https://github.com/arpra-project/mpfi/archive/${pkgver}/${_realname}-${pkgver}.tar.gz)
sha256sums=('32e6ad529c97aa5ce03e28d01c921d1bce1a464fb4c57fbc248d7be21e652782')

prepare() {
  cd ${_realname}-${pkgver}
  autoreconf -fiv
}

build() {
  mkdir -p build-${MSYSTEM} && cd build-${MSYSTEM}

  CFLAGS+=" -Wno-incompatible-pointer-types" \
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --enable-shared \
    --disable-static

  make
}

package() {
  cd build-${MSYSTEM}

  make DESTDIR="${pkgdir}" install

  install -Dm644 "${srcdir}"/${_realname}-${pkgver}/COPYING \
    "${pkgdir}"${MINGW_PREFIX}/share/licenses/${_realname}/COPYING
  install -Dm644 "${srcdir}"/${_realname}-${pkgver}/COPYING.LESSER \
    "${pkgdir}"${MINGW_PREFIX}/share/licenses/${_realname}/COPYING.LESSER
}
